package org.apache.servicecomb.fence.resource;

import org.apache.servicecomb.fence.api.resource.RocketMqMsg;
import org.apache.servicecomb.fence.resource.mapper.RocketMqMsgMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RocketMqMsgLogicService {

    @Autowired
    private RocketMqMsgMapper rocketMqMsgMapper;

    public RocketMqMsg getByMsgId(String msgId) {

        if (msgId == null) {
            throw  new RuntimeException("无有效id");
        }
        return rocketMqMsgMapper.getMsgByMsgId(msgId);
    }

    public int insert(String msgId,String topic,String msgInfo){
        return rocketMqMsgMapper.insert(msgId,topic,msgInfo);
    }
}
